<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../lib/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="firstName" placeholder="请输入姓">+
        <input type="text" v-model="lastName" placeholder="请输入名">
        {{fullName}}|{{fullName2}}

    </div>
</body>
<script>
    new Vue({
        el:"#app",
        data:{
            firstName:"",
            lastName:"",
            fullName:""
        },
        watch:{
            firstName(){
                this.fullName = this.firstName+this.lastName;
            },
            lastName(){
                this.fullName = this.firstName+this.lastName;
            }
        },
        computed:{
            fullName2(){
                return this.firstName+this.lastName;
            }
        }
    })
</script>
</html>